<?php

include "./lib/src/skey.php";

$images_url = base_url('images');
$admin_url = base_url('otakkanan');
$kirim_url = base_url('otakkiri');
$upload_url = base_url('uploads');

$mapdir = "
	<a href='$admin_url/'>Home</a>
	&gt; 
	<b>Edit Profil</b>
";

$hasil = $this->adminmodel->get_data_pengguna($uid);

if($hasil !== FALSE)
{
	foreach($hasil AS $hasil2)
	{
		$uid = $hasil2->uid;
		$username = html_escape($hasil2->username);
		$nama = html_escape($hasil2->nama);
		$email = html_escape($hasil2->email);
		
		if($hasil2->jk == TRUE)
		{
			$jeniskelamin = "<option value='1' selected='selected'>Laki-laki</option>
							<option value='0'>Perempuan</option>";
		}else{
			$jeniskelamin = "<option value='1'>Laki-laki</option>
			<option value='0' selected='selected'>Perempuan</option>";
		}
		
		if( ! empty($hasil2->gambar))
		{
			$gambar = "<a id='lihat' href='$upload_url/pengguna/$hasil2->gambar'><img alt='Gambar Profile' src='$upload_url/pengguna/$hasil2->gambar' style='width:30%' /></a>";
		}else{
			$gambar = "<img alt='Gambar Profile' src='$images_url/noimages.gif' style='width:30%' />";
		}
		
		$tampil = "
					<tr>
						<td class='left'>Nama * </td>
						<td class='right'> <input name='nama' type='text' value='$nama' /></td>
					</tr>
					<tr>
						<td class='left'>E-mail * </td>
						<td class='right'> <input name='email' type='email' value='$email' /> </td>
					</tr>
					<tr>
						<td class='left'>Username </td>
						<td class='right'> $username</td>
					</tr>
					<tr>
						<td class='left'>Password (bila ingin mengubah) </td>
						<td class='right'> 
						<input name='password' type='password' /> <div class='note'>kosongkan bila tidak ingin ubah</div>
						</td>
					</tr>
					<tr>
						<td class='left'>Password (konfirmasi) </td>
						<td class='right'> <input name='password2' type='password' /></td>
					</tr>
					<tr>
						<td class='left'>Jenis Kelamin * </td>
						<td class='right'>
							<select name='jk'>
								$jeniskelamin
							</select>
						</td>
					</tr>
					<tr>
						<td class='left'>Tanggal Lahir * </td>
						<td class='right'> <input name='tgllahir' type='text' id='tgllahir' value='$hasil2->tgllahir' />
							<div class='note'>Format tanggal : yyyy-mm-dd</div>
						</td>
					</tr>
					
					<tr>
						<td class='left'>Gambar </td>
						<td class='right'> 
							<br />
							$gambar<br /><br />
							<input name='gambar' type='file' />
							<div class='note'>Anda Juga bisa menambahkan  Gambar/Foto</div>
						</td>
					</tr>
					<td class='left'>Password saat ini </td>
					<td class='right'> <input name='mypassword' type='password' placeholder='Masukan Password saat ini' />
						<div class='note'>masukan password untuk konfirmasi perubahan</div>
					</td>
						
					<tr>
						<td class='left'>&nbsp;</td>
						<td class='right'>NB : Tanda Bintang (*) berarti Kolom wajib Diisi</td>
					</tr>
					<tr>
						<td class='left'> &nbsp; </td>
						<td class='right'>
							<input type='hidden' name='oldgambar' value='$hasil2->gambar' />
							<input type='submit' value='Ubah'> &nbsp; <input type='reset' value='Ulang'>
						</td>
					</tr>";
	}
}else{
	$tampil = "<tr>
					<td class='left'>&nbsp;</td>
					<td class='right'>Data Tidak Ditemukan</td>
				</tr>";
}

$isipage = "
		<div id='content2'>
				<h3>Edit Profil</h3>
					<div class='isicontent2'>
					
					  <form id='FrmMasukan' action='$kirim_url/updateprofil' method='post' onsubmit='return validasi_profil(this)' enctype='multipart/form-data' >
						
							<table>
								<tbody>
								
									$tampil
								
								</tbody>
							</table>
							
					  </form>
					</div>
					
				</div>
	";


$data['map_dir'] = $mapdir;
$data['isi_page'] = $isipage;
$data['site_title'] = 'Edit Profile - Dadan Network';
$data['base_url'] = base_url();
$data['tahun_sekarang'] = date("Y");

$this->parser->parse('template/admin', $data);


/* End of file editprofile.php */
/* Location: ./application/views/admin/editprofile.php */
